<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <span><button><span>lishi</span> </button></span>
    <script>
        function isPrime(value) {
            if (!isPrime.answers) {
                isPrime.answers = {};
            }
            if (isPrime.answers[value] !== undefined) {
                console.log('缓存');
                return isPrime.answers[value];
            }
            var prime = value !== 0 && value !== 1; // 1 is not a prime  
            for (var i = 2; i < value; i++) {
                if (value % i === 0) { prime = false; break; }
            }
            return isPrime.answers[value] = prime;
        }
        console.log(isPrime(5));;
        console.log('-------');
        console.log(isPrime(5));;

        /** 
     * @param {圆盘数：number} plates 
     * @param {起始柱子 a：string} source 
     * @param {辅助柱子 b：string} helper 
     * @param {目标柱子 c：string} dest 
     * @param {移动步骤集：Array，数组的长度就是移动的次数} moves 
     */
        function hanoi(plates, source, helper, dest, moves = []) {
            if (plates <= 0) {
                return moves;
            }
            if (plates === 1) {
                moves.push([source, dest]);
            } else {
                hanoi(plates - 1, source, dest, helper, moves);
                moves.push([source, dest]);
                hanoi(plates - 1, helper, source, dest, moves);
            }
            return moves;
        }

        // test
        console.log(hanoi(3, 'a', 'b', 'c')); // 输出结果如下图展示
        // function determineType(data) {
        //     let type = {
        //         "[object Function]": 'Function',
        //         "[object String]": 'String',
        //         "[object Array]": 'Array',
        //         "[object Number]": 'Number',
        //         "[object Object]": 'Object',
        //         "[object Boolean]": 'Boolean',
        //         "[object Date]": 'Date',
        //         "[object Symbol]": 'Symbol',
        //     };
        //     if (data === 'null') {
        //         return null
        //     } else if (typeof data === 'undefined') {
        //         return undefined
        //     } else {
        //         let dataType = Object.prototype.toString.call(data);
        //         return type[dataType];
        //     }

        // }
        function formatData(data) {
            let dataType = determineType(data);
            console.log(dataType);
            console.log(dataType === 'Array');
            switch (dataType) {
                case "Array":
                    return []
                case "Object":
                    return {}
                default:
                    return ''
                // case 'Date':

                //     break;
                // case 'Symbol':

                //     break;
                // case 'Function':

                //     break;
                // case 'String':

                //     break;
                // case 'Number':

                //     break;

            }
        }
        let adfsd = '13213'


        // console.log(formatData(adfsd));
        // console.log(determineType());
        // console.log('---------------------------------');
        // let a = "2022-05-01 09:44:00".split(':')
        // console.log(a.pop());
        // console.log(a.join(':'));
        // console.log("{" + '\\\"name\\\"' + ':' + '\\\"姓名\\\"' + ',' + '\\\"value"\\\"' + ":" + `\\\"item.applyNam\\\"` + "}")
        // //克隆
        // let obj = {
        //     a: 1,
        //     get a() {
        //         return 2
        //     }
        // }
        // const clone = Object.create(Object.getPrototypeOf(obj),
        //     Object.getOwnPropertyDescriptor(obj))
        // clone.a = 3
        // console.log('obj');
        // console.log(obj);
        // console.log(obj.a);
        // console.log('clone');
        // console.log(clone);

        // function checkTime(startTime = '00:00', endTime = '00:00') {
        //     let myDate = new Date(),
        //         y = myDate.getFullYear(),
        //         m = myDate.getMonth() + 1,
        //         r = myDate.getDate(),
        //         tempTime = y + '-' + m + '-' + r + ' ';
        //     startTime = tempTime + startTime
        //     endTime = tempTime + endTime

        //     if (new Date(startTime).getTime() >= new Date(endTime).getTime()) {
        //         console.log('true');
        //         return true
        //     }
        // }
        // checkTime('02:02', '01:03')
    </script>
</body>

</html>